package cookie

import (
	"time"
	"net/http"
	"fmt"
)

func Cookie(w http.ResponseWriter,name string ,value string ) http.Cookie{
	expiration := time.Now()
	expiration = expiration.AddDate(1, 0, 0)
	cookie := http.Cookie{Name: name, Value: value, Expires: expiration}
	http.SetCookie(w, &cookie)
	return cookie
}

func GetCookie(w http.ResponseWriter,r *http.Request) {
	for _, cookie := range r.Cookies() {
		fmt.Fprint(w, cookie.Name)
	}
}